package com.zwb.boot.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author 头发又黑又长
 * @Date 2022/7/18 15:10
 * @email zwb15083976291@163.com
 */
@Profile({"dev"})
@EnableSwagger2
@Configuration
public class SwaggerConfig {
    @Bean
    public Docket docket() {
        Docket docket = new Docket(DocumentationType.SWAGGER_2);
        ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder();
        apiInfoBuilder.contact(
                new Contact("瑞吉外卖项目开发文档",
                        "http://www.tfyhyc.cn",
                        "3092298979@qq.com"))
                .title("瑞吉外卖项目")
                .description("本课程以当前热门的外卖点餐为业务基础，业务真实、实用、广泛。基于流行的Spring Boot、mybatis plus等技术框架进行开发")
                .version("0.0.1");
        docket = docket.apiInfo(apiInfoBuilder.build())
                .select().apis(RequestHandlerSelectors.basePackage("com.zwb.boot.controller")).build();
        return docket;
    }

}
